import request from '@/utils/request'

// 获取文章
export const getArticleList = ({ pagenum, pagesize, cate_id, state }) => {
  return request.get('/my/article/list', {
    params: {
      pagenum,
      pagesize,
      cate_id,
      state
    }
  })
}

// 发布文章
export const addArticle = obj => {
  return request.post('/my/article/add', obj, { headers: { 'Content-Type': 'multipart/form-data' } })
}

// 获取文章详情
export const getArticleInfo = id => {
  return request.get('/my/article/info', { params: { id } })
}

// 删除文章
export const delArticle = id => {
  return request.delete('/my/article/info', { params: { id } })
}

// 更新文章
export const updateArticle = obj => {
  return request.put('/my/article/info', obj, { headers: { 'Content-Type': 'multipart/form-data' } })
}
